<?php
require_once MODEL_DIR.'/DevNotesModel.php';
$oDevNotesInstance = new DevNotesModel();

if(isset($_GET['option'])){
	if(isset($_POST['submit'], $_POST['idNote'])){
		switch($_GET['option']){
			case 'check':
				DevNotesModel::editNote($_POST);
				header('Location: index.php?page=adminIndex&mod=devNotes&action=edit');
			break;
			case 'edit':
				$aiassNotesList = $oDevNotesInstance->getNotes('WHERE idNote = '.$_POST['idNote']);
				$asmNote = $aiassNotesList[0];
				require_once VIEW_DIR.'/formDevNotesEdit.php';
			break;
			default:
				header('Location: index.php?page=adminIndex&mod=devNotes&action=edit');
			break;
		}
	}
}else{
	$aiassNotesList = $oDevNotesInstance->getNotes();
	require_once VIEW_DIR.'/formDevNotesSelectEdit.php';
}
